﻿(function () {
    "use strict";
    var e = window.jQuery,
		t = window.qh360cp,
		n = window._;
    t.pages = t.pages || {}, t.pages.init = function () {
        e(".close").on("click", function () {
            e(this).parent().hide()
        }), e(".select-box span").on("mouseover", function () {
            e(this).siblings("ul").slideDown("fast"), e(this).find(".ico").addClass("ico-up")
        }), e("#lottype ul li").on("click", function () {
            var t = e(this),
				n = t.attr("url"),
				r = t.parents(".select-box"),
				i = t.text();
            e(".select-box ul").slideUp("fast"), r.find("em").html(i), location.href = n
        }), e(".select-box").hover(function () { }, function () {
            var t = this;
            setTimeout(function () {
                e(t).find("ul").slideUp("fast"), e("#lottype").find(".ico").removeClass("ico-up")
            }, 300)
        }), e("#gate_txt").on("click", ".autobuy", function (n) {
            n.preventDefault(), n.stopPropagation();
            var r = this.getAttribute("uid");
            r || t.lightBox.alert({
                content: "\u672a\u627e\u5230\u65b9\u6848\u7f16\u53f7\uff0c\u8bf7\u5237\u65b0\u8bd5\u8bd5\u6216\u8054\u7cfb\u5728\u7ebf\u5ba2\u670d\uff01"
            });
            var i = e("#doc3").attr("lotid");
            t.lightBox.auto_buy(i, r)
        }), e("#gate_txt").on("click", "a.nZhanji", function (n) {
            n.preventDefault(), n.stopPropagation();
            var r = this.getAttribute("uid");
            r || t.lightBox.alert({
                content: "\u672a\u627e\u5230\u65b9\u6848\u7f16\u53f7\uff0c\u8bf7\u5237\u65b0\u8bd5\u8bd5\u6216\u8054\u7cfb\u5728\u7ebf\u5ba2\u670d\uff01"
            }), t.lightBox.zhanji(e("#doc3").attr("lotid"), r)
        }), e(".ranking-table tbody tr:even").hover(function () {
            e(this).addClass("line-light")
        }, function () {
            e(this).next("tr").is(":hidden") && e(this).css("background", ""), e(this).removeClass("line-light")
        }).on("click", function (t) {
            var n = e(this);
            if (e(t.target).attr("uid")) return;
            n.next("tr").is(":hidden") ? (n.css("background", "#fff7e4"), n.siblings("tr").removeClass("line-light").css("background", "").find(".operate").removeClass("operate-up"), n.addClass("line-light").find(".operate").addClass("operate-up"), n.siblings(".content").hide(), n.next("tr").show()) : (n.find(".operate").removeClass("operate-up"), n.removeClass("line-light"), n.next("tr").hide())
        })
    }, e(window).scroll(function () {
        t.pages.tableFloat()
    }), e(window).resize(function () {
        t.pages.tableFloat()
    }), t.pages.tableFloat = function () {
        var t, n, r, i, s;
        s = e(".ranking-table").eq(0), s.hide(), t = e(window).scrollTop();
        var o = s.next("table");
        r = o.offset().top, i = o.height(), n = t - r, s.css("top", n), n > 0 && n - i + 30 < 0 ? s.show() : s.hide()
    }, t.pages.getURL = function () {
        var n = t.string.get_url_param("ProjID", window.location.href),
			r = !0;
        e(".ranking-table tbody tr:even").each(function () {
            e(this).attr("pid") * 1 == n * 1 && (e(this).css("background", "#fff7e4"), e(this).find(".operate").addClass("operate-up"), e(this).next("tr").show(), r = !1)
        }), r && e(".ranking-table tbody tr:even").eq(0).css("background", "#fff7e4").next("tr").show().end().find(".operate").addClass("operate-up")
    }, e(function () {
        t.pages.init(), t.pages.getURL()
    })
})();